/* 全局样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
  background-color: #f1f1f1;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.9em;
}

button {
  cursor: pointer;
  padding: 8px 16px;
  background-color: #4a6cf7;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  transition: background-color 0.3s;
  margin: 5px;
}

button:hover {
  background-color: #3a56d4;
}

input, select, textarea {
  padding: 8px;
  margin: 5px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

ul {
  list-style-type: none;
}

pre {
  background-color: #f1f1f1;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.9em;
  margin: 10px 0;
}

/* App布局 */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background-color: #4a6cf7;
  color: white;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-description {
  margin-top: 10px;
  font-size: 16px;
  opacity: 0.9;
}

.app-container {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.app-nav {
  width: 250px;
  padding-right: 20px;
  border-right: 1px solid #eaeaea;
}

.app-nav ul {
  position: sticky;
  top: 20px;
}

.app-nav li {
  margin-bottom: 15px;
}

.app-nav a {
  display: block;
  padding: 10px;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.3s;
}

.app-nav a:hover {
  background-color: #f0f4ff;
  color: #4a6cf7;
}

.app-nav a.active {
  background-color: #4a6cf7;
  color: white;
}

.nav-description {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 3px;
  padding-left: 10px;
}

.app-content {
  flex: 1;
  padding: 0 20px;
}

.app-footer {
  background-color: #f1f1f1;
  padding: 15px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

/* Hook示例组件样式 */
.hook-example {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin-bottom: 20px;
}

.hook-example h2 {
  color: #4a6cf7;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eaeaea;
}

.hook-example h3 {
  margin: 20px 0 10px;
  color: #333;
}

.hook-example section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eaeaea;
}

.hook-example section:last-child {
  border-bottom: none;
}

.explanation {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 6px;
  margin-top: 20px;
}

.explanation h3 {
  color: #4a6cf7;
  margin-bottom: 10px;
}

.explanation ul {
  padding-left: 20px;
  list-style-type: disc;
}

.explanation ul ul {
  margin-top: 5px;
  margin-bottom: 10px;
}

.note {
  font-style: italic;
  color: #666;
  font-size: 0.9em;
  margin-top: 8px;
}

/* 表单样式 */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.error {
  color: #e74c3c;
  font-size: 0.85em;
  margin-top: 5px;
}

/* 计数器样式 */
.counter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.counter span {
  font-size: 18px;
  min-width: 40px;
  text-align: center;
}

/* 切换开关样式 */
.toggle {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* 待办事项列表样式 */
.todo-list {
  margin: 15px 0;
}

.todo-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.todo-list li.completed span {
  text-decoration: line-through;
  color: #888;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .app-nav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eaeaea;
    padding-right: 0;
    padding-bottom: 20px;
    margin-bottom: 20px;
  }
  
  .app-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .app-nav li {
    margin-bottom: 0;
  }
  
  .nav-description {
    display: none;
  }
  
  .app-content {
    padding: 0;
  }
}

/* 特定组件样式 */
.memoized-button, .count-display {
  border: 1px solid #eaeaea;
  padding: 10px;
  margin: 10px 0;
  border-radius: 4px;
  background-color: #f9f9f9;
}

.render-info {
  font-size: 12px;
  color: #888;
  margin-top: 5px;
}

.callback-comparison {
  display: flex;
  gap: 20px;
  margin: 20px 0;
}

.callback-comparison > section {
  flex: 1;
  padding: 15px;
  border: 1px solid #eaeaea;
  border-radius: 6px;
  background-color: #f9f9f9;
}

@media (max-width: 600px) {
  .callback-comparison {
    flex-direction: column;
  }
}

.animated-box {
  margin: 10px 0;
}

.user-info, .items-list, .form-preview, .storage-info, .search-info {
  margin-top: 15px;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 4px;
}

.performance-note {
  font-size: 12px;
  color: #4a6cf7;
  font-style: italic;
  margin-top: 5px;
}

/* 自定义Hooks示例样式 */
.local-storage-example, .window-size-example, .debounce-example {
  padding: 15px;
  border: 1px solid #eaeaea;
  border-radius: 6px;
  margin-top: 10px;
}

.size-display {
  font-size: 18px;
  margin-bottom: 15px;
}

.responsive-demo {
  margin-top: 20px;
}

.responsive-box {
  margin: 15px 0;
  text-align: center;
}

.search-container {
  margin-bottom: 20px;
}

.search-results {
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 4px;
}

.search-results ul {
  padding-left: 20px;
  list-style-type: disc;
}